#个人中心页
from common.com import ForumDriver
from selenium.webdriver.common.by import By



class PersonalInform:
    driver = ""
    url = ""
    def __init__(self):
        self.url= ("http://127.0.0.1:58080/index.html")
        self.driver = ForumDriver.driver
        self.driver.get( self.url )


    def MyInform(self):
        # 点击进入个人中心
        self.driver.find_element( By.CSS_SELECTOR, "#index_nav_avatar" ).click()
        self.driver.find_element( By.CSS_SELECTOR, "#index_user_settings" ).click()
        #用户中心界面
        self.driver.find_element( By.CSS_SELECTOR,"#bit-forum-content > div.page-header.d-print-none > div > div > div > h2")
        ForumDriver.getScreenShot()
        #修改昵称
        self.driver.find_element( By.CSS_SELECTOR,"#setting_input_nickname").send_keys("xiaohe")
        self.driver.find_element( By.CSS_SELECTOR,"#setting_submit_nickname").click()
        #修改邮箱地址
        #self.driver.find_element( By.CSS_SELECTOR,"#setting_input_email" ).send_keys( "2503332363@qq.com" )
        #self.driver.find_element( By.CSS_SELECTOR,"#setting_submit_email" ).click()
        #修改电话号码
        self.driver.find_element( By.CSS_SELECTOR, "#setting_input_phoneNum" ).send_keys( "1234567890" )
        self.driver.find_element( By.CSS_SELECTOR, "#setting_submit_phoneNum" ).click()
        # 个人简介
        self.driver.find_element( By.CSS_SELECTOR, "#settings_textarea_remark" ).send_keys( "我是一个好人" )
        self.driver.find_element( By.CSS_SELECTOR, "#settings_submit_remark" ).click()
        # 屏幕截图
        ForumDriver.getScreenShot()
        #修改密码
        self.driver.find_element( By.CSS_SELECTOR, "#settings_input_oldPassword" ).send_keys( "123456" )#原密码
        self.driver.find_element( By.CSS_SELECTOR, "#settings_input_newPassword" ).send_keys( "123" )#新原密码
        self.driver.find_element( By.CSS_SELECTOR, "#settings_input_passwordRepeat" ).send_keys( "123" )#确认密码
        self.driver.find_element( By.CSS_SELECTOR, "#settings_submit_password" ).click()
        #确认返回成功，跳转到登录页
        self.driver.find_element( By.CSS_SELECTOR, "body > div > div > div > div:nth-child(1) > div > div.card.card-md > div > h2")
        # 屏幕截图
        ForumDriver.getScreenShot()






